import { listPlatforms } from '@/api/business/platforms'
import { getDicts } from '@/api/system/dict/data'
const namespaced = true;
const state = {
    platformList: [], // 平台列表
    processList: []
}

const mutations = {
    SET_PLATFORM_INFO: (state, val) => {
        Object.assign(state, val)
    },
}
const actions = {
    // 查询平台列表
    getPlatformList ({ commit, state }) {
        listPlatforms().then(res => {
            console.log(res);
            commit('SET_PLATFORM_INFO', { platformList: res.rows })
        })
    },
    //   查询进度字典
    getProcessDict ({ commit, state }) {
        getDicts('bus_execute_process').then(res => {
            console.log(res);
            commit('SET_PLATFORM_INFO', {
                processList: res.data.map(item => {
                    return {
                        label: item.dictLabel,
                        value: +item.dictValue
                    }
                })
            })
        })
    }
}

export default {
    namespaced, state, mutations, actions
}
